<?php
/**
 * User: aka
 * Time: 21:10
 */

namespace app\update\controller;

use app\validate\clanActivity\SendClanActivity;
use think\facade\Session;
use think\Request;

class ClanActivity
{
    private $userId;
    private $deleteState = 1;

    public function __construct()
    {
        $this->userId = Session::get('user_info.id');
    }

    public function __destruct()
    {
        unset(
            $this->userId,
            $this->deleteState
        );
    }

    public function deleteClanActivity(Request $request)
    {
        $condition = array();
        $condition['uid'] = $this->userId;
        $condition['id'] = base64_decode($request->param('id'));
        $updateData = array();
        $updateData['delete_state'] = $this->deleteState;
        $updateData['delete_time'] = time();
        \app\tenno\model\ClanActivity::where($condition)->update($updateData);
        return json(['state' => 200]);
    }
}